package kk.service;

import kk.domain.Permission;
import kk.domain.Role;

import java.util.List;

public interface RoleService {

    /**
     * 查询所有角色
     * @return
     * @throws Exception
     */
    public List<Role> findAll(Integer pageNum,Integer pageSize) throws Exception;

    /**
     * 添加角色
     * @param role
     * @throws Exception
     */
    public void save(Role role) throws Exception;

    /**
     * 根据角色id查询角色详细信息
     * @param id
     * @return
     * @throws Exception
     */
    public Role findById(Integer id) throws Exception;

    /**
     * 删除角色
     * @param id
     * @throws Exception
     */
    public void deleteRole(Integer id) throws Exception;

    /**
     * 根据roleID查询出该角色没有的权限
     * @param roleId
     * @return
     */
    public List<Permission> findOtherPermission(Integer roleId) throws Exception;

    /**
     * 给角色添加该角色没有的权限
     * @param roleId
     * @param ids
     * @throws Exception
     */
    public void addPermissionToRole(Integer roleId,int[] ids) throws Exception;

    /**
     * 查询出该角色已经拥有的权限
     * @param roleId
     * @return
     */
    public List<Permission> findCanDeletePermission(Integer roleId);

    public void deletePermissionFromRole(Integer roleId, int[] ids);
}
